import 'and_rule.dart';
import 'error_rule.dart';
import 'or_rule.dart';
import 'rule.dart';
import 'single/js_rule.dart';
import 'single/single_rule.dart';

class ParseFactory {
  static IParser<Rule> getParser(Rule? rule) {
    if (rule is AndRule) {
      return AndParser(rule);
    } else if (rule is SingleRule) {
      return SingleParser(rule);
    } else if (rule is OrRule) {
      return OrParser(rule);
    } else if (rule is JsRule) {
      return JsParser(rule);
    }
    return ErrorParser(rule);
  }
}
